package com.example.yiqiuser.controller;


import com.example.yiqiuser.entity.Order;
import com.example.yiqiuser.entity.SbsnOrder;
import com.example.yiqiuser.service.PayService;
import com.example.yiqiuser.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @ fileName:PayController
 * @ description:
 * @ author:zhz
 * @ createTime:2023/3/31 12:36
 * @ version:1.0.0
 */
@RequestMapping("pay")
@RestController
public class PayController extends  BaseController {

    @Resource
    private PayService payService;

    /**
     * 生成二维码
     * @param sbsnOrder
     * @return
     */
    @PostMapping("getNativeCodeUrl")
    public Result getNativeCodeUrl(@RequestBody SbsnOrder sbsnOrder){
        Map map=payService.getNativeByOrder(sbsnOrder);
        return success(map);
    }

    /**
     * 获取支付状态
     * @param orderNo
     * @return
     */
    @GetMapping("getPayStatus/{orderNo}")
    public Result getPayStatus(@PathVariable("orderNo") String orderNo)   {
        Map<String, String> map = payService.getPayStatus(orderNo);
        return success(map);
    }
}
